package com.code.leetcode.offer;

/**
 * @author codeDorado
 * @version 1.0
 * @date 2020/8/2 21:53
 */
public class The46_dp_滚动数组 {
    public int translateNum(int num) {
        String str = String.valueOf(num);
        int p = 0, q = 0, r = 1;
        for (int i = 0; i < str.length(); i++) {
            p = q;
            q = r;
            r = 0;
            r += q;
            if (i == 0) continue;
            String s = str.substring(i - 1, i + 1);
            if (s.compareTo("25") <= 0 && s.compareTo("10") >= 0) {
                r += p;
            }
        }
        return r;
    }


    public static void main(String[] args) {
        // String str = "0123456789";
        // System.out.println(str.substring(0, 2));
        int p = 0, q = 0, r = 1;
        p = q;
        q = r;
        r = p;
        System.out.println(p + " " + q + " " + r);
        r = 10;
        System.out.println(p + " " + q + " " + r);
    }
}
